package org.linlinjava.litemall.admin.strategy;

import com.alipay.api.domain.OpenApiRoyaltyDetailInfoPojo;
import org.linlinjava.litemall.admin.strategy.Interface.AliPayStrategy;
import org.linlinjava.litemall.db.domain.LitemallMechanism;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;

/**
 * @author zhy
 * @date 2019-01-25 10:51
 **/
@Service
public class AliPayModelListService {
	private HashMap<String, AliPayStrategy> maps = new HashMap<>();

	public AliPayModelListService(List<AliPayStrategy> aliPayStrategies) {
		for (AliPayStrategy aliPayStrategy : aliPayStrategies) {
			maps.put(aliPayStrategy.getMechanismLevel(), aliPayStrategy);
		}
	}

	public OpenApiRoyaltyDetailInfoPojo saleMethod(String type, LitemallMechanism litemallMechanism) {
		return maps.get(type).getModel(litemallMechanism);
	}
}
